﻿using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace MadearteNovo.Site.Pages
{
    public partial class Home : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            DirectoryInfo pasta = new DirectoryInfo(Server.MapPath("/Imagens/Slider/"));
            FileInfo[] arquivos = pasta.GetFiles();

            DataTable dt = new DataTable();
            dt.Columns.Add("Url");

            foreach (FileInfo file in arquivos)
            {
                DataRow dr = dt.NewRow();
                dr["Url"] = ResolveUrl("/Imagens/Slider/" + file.Name);

                dt.Rows.Add(dr);
            }

            rptSlider.DataSource = dt;
            rptSlider.DataBind();
        }
    }
}